﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe Name="CreateVSCommand" xmlns="http://schemas.microsoft.com/pag/gax-core"
                               xmlns:xi="http://www.w3.org/2001/XInclude" Bound="false">
  <DocumentationLinks>
    <Link Kind="Documentation" Caption="VS Menus and Toolbars general" Url="ms-help://MS.VSCC.v90/MS.VSIPCC.v90/MS.VSSDK.v90/dv_vsintegration/html/07b4ed90-dbbd-40df-b6c9-8395fd6f2ab6.htm" />
    <Link Kind="Documentation" Caption="Visual Studio Command Table (.Vsct) Files " Url="ms-help://MS.VSCC.v90/MS.VSIPCC.v90/ms.vssdk.v90/dv_vsintegration/html/1313adb4-add4-4e74-90e2-f4be522f5259.htm" />
  </DocumentationLinks>
  <xi:include href="../Common/CommonTypeAliases.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Types)" />
  <Caption>VS Command</Caption>
  <Description>VS Command</Description>
  <HostData>
    <Icon ID="4206" />
    <CommandBar Menu="VSSDKAssistProjectCreate"/>
  </HostData>
  <Arguments>
    <xi:include href="../Common/CommonArguments.xml"
					  xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Arguments/gax:Argument)" />
    <Argument Name="VSPackageProject" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.CurrentlySelectedProjectValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="VSPackageProjectNamespace" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(VSPackageProject.Properties.Item('DefaultNamespace').Value.ToString())"
                     Stage="OnBeginRecipe">
      </ValueProvider>
    </Argument>
    <Argument Name="DestinationFolder" Required="true">
      <ValueProvider Type="Evaluator" 
                     Expression="Commands" 
                     Stage="OnBeginRecipe"/>
    </Argument>    
    <Argument Name="VSPackageCodeClass" Type="EnvDTE.CodeClass, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.VSPackageCodeClassValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="CommandName" Required="true"/>
    <Argument Name="CommandId" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.HexNumberValueProvider, VSSDKAssist" 
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="GroupName" Required="true">
      <ValueProvider Type="Evaluator" 
                     Expression="$(CommandName)Group"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="CommandName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="GroupId" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.HexNumberValueProvider, VSSDKAssist" 
                     Stage="OnBeginRecipe"/>
    </Argument>    
    <Argument Name="LanguageExtension" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.CurrentlySelectedProjectLanguageValueProvider, VSSDKAssist.Assets"
               Stage="OnBeginRecipe">
      </ValueProvider>
    </Argument>
    <Argument Name="CommandIdFileName" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(CommandName)Constants.$(LanguageExtension)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="CommandName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="CommandCaption" Required="true"/>
    <Argument Name="CommandIdCSNamespace" Required="true">
      <ValueProvider Type="Evaluator" 
                     Expression="$(VSPackageProjectNamespace).$(DestinationFolder)"
                     Stage="OnBeginRecipe">
        <MonitorArgument Name="VSPackageProjectNamespace"/>
        <MonitorArgument Name="DestinationFolder"/>
      </ValueProvider>
    </Argument>
    <Argument Name="VSCTProjectItem" Type="EnvDTE.ProjectItem, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.VSCTProjectItemValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="DefaultParentGroup" Type="System.Boolean" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="true"
                     Stage="OnBeginRecipe" />
    </Argument>
    <Argument Name="ParentGroupIdAlias" Required="false"/>
    <Argument Name="OtherParentGroupGuid" Required="false">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.Framework.EmptyGuidValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe" />
    </Argument>    
    <Argument Name="OtherParentGroupId" Required="false">
      <ValueProvider Type="Evaluator"
                     Expression="0"
                     Stage="OnBeginRecipe" />
    </Argument>
    <Argument Name="CommandBitmapGuid" Type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.Framework.GuidValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="CommandGuid" Type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.Framework.GuidValueProvider, VSSDKAssist.Assets"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="BitmapDestinationFolder" Type="EnvDTE.ProjectItem, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.ResourcesFolderValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="BitmapFileName" Required="true">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.EmptyBitmapValueProvider, VSSDKAssist"
                     ImageSize="Size16x16"
                     Stage="OnBeginRecipe"/>
    </Argument>
    <Argument Name="CommandIdTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="VSCommand"
                     TTFile="CommandId.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="CommandHandlerCallTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="VSCommand"
                     TTFile="CommandHandlerCall.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="CommandHandlerTT">
      <ValueProvider Type="VSSDKAssist.Recipes.Common.ValueProviders.TTPathValueProvider, VSSDKAssist"
                     Stage="OnBeginRecipe"
                     SubPath="VSCommand"
                     TTFile="CommandHandler.tt">
      </ValueProvider>
    </Argument>
    <Argument Name="RelativeBitmapDestinationFolder" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.RelativeProjectItemPathValueProvider, VSSDKAssist.Assets"
                     ProjectItemArgument="BitmapDestinationFolder"
                     Stage="OnBeforeActions">
        <MonitorArgument Name="BitmapDestinationFolder"/>
      </ValueProvider>
    </Argument>
    <Argument Name="BitmapFile" Required="true">
      <ValueProvider Type="VSSDKAssist.Assets.ValueProviders.VisualStudio.FileNameValueProvider, VSSDKAssist.Assets"
                     FileArgument="BitmapFileName"
                     Stage="OnBeforeActions">
        <MonitorArgument Name="BitmapFileName"/>
      </ValueProvider>
    </Argument>
    <Argument Name="BitmapHref" Required="true">
      <ValueProvider Type="Evaluator"
                     Expression="$(RelativeBitmapDestinationFolder)$(BitmapFile)"
                     Stage="OnBeforeActions">
        <MonitorArgument Name="RelativeBitmapDestinationFolder"/>
        <MonitorArgument Name="BitmapFile"/>
      </ValueProvider>
    </Argument>
  </Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page Type="VSSDKAssist.Recipes.CreateVSCommandVSCT.CreateVSCommandCP1, VSSDKAssist" 
          Height="200" Width="510">
          <Title>Specify command general properties</Title>
          <LinkTitle>Command general properties</LinkTitle>
        </Page>
        <Page Type="VSSDKAssist.Recipes.CreateVSCommandVSCT.CreateVSCommandCP2, VSSDKAssist"
          Height="200" Width="510">
          <Title>Specify command UI properties</Title>
          <LinkTitle>Command UI properties</LinkTitle>
        </Page>        
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions CoordinatorServiceType="VSSDKAssist.Recipes.Common.Coordinators.ExecutionProgressCoordinator, VSSDKAssist">
    <!--Create Folder-->
    <Action Name="GenerateDestinationFolder"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddProjectFolderAction, VSSDKAssist.Assets"
          StatusMessage="Creating destination folder"
          WriteMessageToOutputWindow="true">
      <Input Name="FolderName" RecipeArgument="DestinationFolder"/>
      <Output Name="FolderAdded" />
    </Action>
    <!--Update VSCT file-->
    <Action Name="GenerateSymbolDefinition"
            Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
            Template="TT\common\VSCommand\SymbolDefinition.tt"
            StatusMessage="Updating VSCT file"
            WriteMessageToOutputWindow="true">
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="CommandId" RecipeArgument="CommandId"/>
      <Input Name="CommandGuid" RecipeArgument="CommandGuid"/>
      <Input Name="GroupName" RecipeArgument="GroupName"/>
      <Input Name="GroupId" RecipeArgument="GroupId"/>
      <Input Name="CommandBitmapGuid" RecipeArgument="CommandBitmapGuid"/>
      <Input Name="DefaultParentGroup" RecipeArgument="DefaultParentGroup"/>
      <Input Name="OtherParentGroupGuid" RecipeArgument="OtherParentGroupGuid"/>
      <Input Name="OtherParentGroupId" RecipeArgument="OtherParentGroupId"/>
      <Output Name="Content" />
    </Action>
    <Action Name="InsertSymbolDefinition" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextAction, VSSDKAssist.Assets"
        SearchExpression="&lt;/Symbols&gt;" 
        InsertPosition="Before">
      <Input Name="ProjectItem" RecipeArgument="VSCTProjectItem" />
      <Input Name="TextToInsert" ActionOutput="GenerateSymbolDefinition.Content" />
    </Action>
    <Action Name="GenerateGroupDefinition"
        Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
        Template="TT\common\VSCommand\GroupDefinition.tt">
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="GroupName" RecipeArgument="GroupName"/>
      <Input Name="DefaultParentGroup" RecipeArgument="DefaultParentGroup"/>
      <Input Name="ParentGroupIdAlias" RecipeArgument="ParentGroupIdAlias"/>
      <Output Name="Content" />
    </Action>
    <Action Name="InsertGroupDefinition" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextAction, VSSDKAssist.Assets"
        SearchExpression="&lt;/Groups&gt;"
        InsertPosition="Before">
      <Input Name="ProjectItem" RecipeArgument="VSCTProjectItem" />
      <Input Name="TextToInsert" ActionOutput="GenerateGroupDefinition.Content" />
    </Action>
    <Action Name="GenerateCommandDefinition"
        Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
        Template="TT\common\VSCommand\CommandDefinition.tt">
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="CommandCaption" RecipeArgument="CommandCaption"/>
      <Input Name="GroupName" RecipeArgument="GroupName"/>
      <Output Name="Content" />
    </Action>
    <Action Name="InsertCommandDefinition" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextAction, VSSDKAssist.Assets"
        SearchExpression="&lt;/Buttons&gt;"
        InsertPosition="Before">
      <Input Name="ProjectItem" RecipeArgument="VSCTProjectItem" />
      <Input Name="TextToInsert" ActionOutput="GenerateCommandDefinition.Content" />
    </Action>
    <Action Name="GenerateBitmapDefinition"
        Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
        Template="TT\common\VSCommand\BitmapDefinition.tt">
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="BitmapHref" RecipeArgument="BitmapHref"/>
      <Output Name="Content" />
    </Action>
    <Action Name="InsertBitmapDefinition" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextAction, VSSDKAssist.Assets"
        SearchExpression="&lt;/Bitmaps&gt;"
        InsertPosition="Before">
      <Input Name="ProjectItem" RecipeArgument="VSCTProjectItem" />
      <Input Name="TextToInsert" ActionOutput="GenerateBitmapDefinition.Content" />
    </Action> 
    <!--Create CommandConstants-->
    <Action Name="GenerateCommandCS"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
          StatusMessage="Creating CommandConstants"
          WriteMessageToOutputWindow="true">
      <Input Name="Template" RecipeArgument="CommandIdTT"/>
      <Input Name="CommandIdCSNamespace" RecipeArgument="CommandIdCSNamespace"/>
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="CommandId" RecipeArgument="CommandId"/>
      <Input Name="CommandGuid" RecipeArgument="CommandGuid"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddCommandCSContent"
          Type="VSSDKAssist.Assets.Actions.VisualStudio.AddItemFromStringToProjectItemAction, VSSDKAssist.Assets"
          Open="true">
      <Input Name="Content" ActionOutput="GenerateCommandCS.Content" />
      <Input Name="TargetFileName" RecipeArgument="CommandIdFileName"/>
      <Input Name="InputProjectItem" ActionOutput="GenerateDestinationFolder.FolderAdded" />
      <Output Name="ProjectItem" />
    </Action>
    <!--Add Command Handler-->
    <Action Name="GenerateCommandHandler"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
          StatusMessage="Adding command registration information"
          WriteMessageToOutputWindow="true">
      <Input Name="Template" RecipeArgument="CommandHandlerTT"/>
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Input Name="CommandIdCSNamespace" RecipeArgument="CommandIdCSNamespace"/>
      <Output Name="Content" />
    </Action>
    <Action Name="InsertCommandHandler" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextToCodeElementAction, VSSDKAssist.Assets">
      <Input Name="TextToInsert" ActionOutput="GenerateCommandHandler.Content" />
      <Input Name="CodeElement" RecipeArgument="VSPackageCodeClass" />
    </Action>
    <!--Add Command Handler Call-->
    <Action Name="GenerateCommandHandlerCallContent"
          Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library">
      <Input Name="Template" RecipeArgument="CommandHandlerCallTT"/>
      <Input Name="CommandName" RecipeArgument="CommandName"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddInitializeMethod" Type="VSSDKAssist.Recipes.Common.Actions.AddVSPackageInitializeFunctionAction, VSSDKAssist">
      <Input Name="CodeClass" RecipeArgument="VSPackageCodeClass" />
      <Output Name="CodeFunction" />
    </Action>
    <Action Name="InsertCommandHandlerCall" Type="VSSDKAssist.Assets.Actions.VisualStudio.InsertTextToCodeElementAction, VSSDKAssist.Assets">
      <Input Name="TextToInsert" ActionOutput="GenerateCommandHandlerCallContent.Content" />
      <Input Name="CodeElement" ActionOutput="AddInitializeMethod.CodeFunction" />
    </Action>
    <!--Add Bitmap File-->
    <Action Name="AddBitmapFile" Type="VSSDKAssist.Assets.Actions.VisualStudio.AddItemFromFileToProjectItemAction, VSSDKAssist.Assets"
            Open="false"
            StatusMessage="Adding bitmap file"
            WriteMessageToOutputWindow="true">
      <Input Name="SourceFileName" RecipeArgument="BitmapFileName"/>
      <Input Name="InputProjectItem" RecipeArgument="BitmapDestinationFolder"/>
      <Output Name="ProjectItem" />
    </Action>
    <!-- //TODO: Indent vsct file -->
  </Actions>
</Recipe>